let fn = async (alias, { socket, io, reg, user, NOTIFY, ROOM_USERS, JOIN_ROOM }, topic) => {
    try {
        // 当前用户信息
        await user.setInfo({alias})
        await reg.dao.userSetInfo(user.name, {alias})
        let ua = user.toSender()
        let rs = await reg.dao.roomsOfUser(user.name)
        for (let r of rs) {
            let room = await reg.rooms.getRoom(r)
            room.resetMemberCache()
            let members = room.members()
            await room.broadcast(u => {
                u.socket.emit(JOIN_ROOM, ua)
                u.socket.emit(ROOM_USERS, members)
            })
        }
    } catch ({ message }) {
        socket.emit(NOTIFY, {
                topic,
                data: message,
            })
    }
}

module.exports = fn